<template>
	<view class="contents">
		<pds-user-info :userInfo="userInfo"></pds-user-info>
		<pds-order :orderCounts="orderCounts"></pds-order>
		<pds-service></pds-service>
		<view class="mt20">
			<pds-goods-recommend v-if="recommendGoodsList.length > 0" name="精选推荐" :goodsList="recommendGoodsList"></pds-goods-recommend>
		</view>
	</view>
</template>

<script>
	import pdsUserInfo from "./childComps/pds-user-info.vue"
	import pdsOrder from "./childComps/pds-order.vue"
	import pdsService from "./childComps/pds-service.vue"
	export default {
		components:{
			pdsUserInfo,
			pdsOrder,
			pdsService
		},
		data() {
			return {
				userInfo:{},
				orderCounts:[0,0,0,0],
				recommendGoodsList:[],
			}
		},
		methods: {
			getUserInfo(){
				this.userInfo = uni.getStorageSync('userInfo');
			},
			getOrderCounts(){
				this.$u.api.getOrderCounts().then(res => {
					this.orderCounts = res.data;
				});
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.checkLogin();
			this.getUserInfo();
			this.getOrderCounts();
			this.getGoodsRecommend(this).then(val=>{ this.recommendGoodsList = val });
		}
	}
</script>

<style lang="scss" scoped>
	/deep/ .goods-recommend{
		padding: 0rpx;
	}
</style>
<style lang="scss">
	page{
		background-color: $u-bg-color;
	}
	.mt20{
		margin-top: 20rpx;
	}
	.contents {
		// display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 20rpx;
		background-position: center top;
		background-repeat:no-repeat;
		background-size:contain;
		background-image:url('');
	}
</style>
